#cs
	Eqso Class

	@author Julot <andy.julot@gmail.com>
	@since Saturday, May 12, 2012. 11:33 AM
#ce

#include <AutoitObject.au3>

Global $_eqsoError = ObjEvent("AutoIt.Error", "__eqsoError")

Func __eqsoError($self)
	$error = "! COM Error !  Number: 0x" & Hex($_eqsoError.number, 8)
	$error &= "   ScriptLine: " & $_eqsoError.scriptline & " - "
	$error &= $_eqsoError.windescription & @CRLF
	ConsoleWrite($error)
	Return
EndFunc   ;==>__eqsoError

Func Eqso()
	Local $c = _AutoItObject_Class()
	$title = '  Senkom Mitra Polri - Komunikasi via eQSO M0ZPD  V2.1'
	$title &= "                                   "

	With $c
		.AddProperty("title", $ELSCOPE_READONLY, $title)

		.AddMethod("exist", "_eqsoExist")
		.AddMethod("connect", "_eqsoConnect")
		.AddMethod("disconnect", "_eqsoDisconnect")
		.AddMethod("changeRoom", "_eqsoChangeRoom")
	EndWith
	Return $c.Object
EndFunc   ;==>Eqso

Func _eqsoExist($self)
	#forceref $self
	Return WinExists($self.title)
EndFunc   ;==>_eqsoExist

Func _eqsoConnect($self)
	#forceref $self
	ControlClick($self.title, 'Hubungkan', 1000, 'left')
	Sleep(1000)
EndFunc   ;==>_eqsoConnect

Func _eqsoDisconnect($self)
	#forceref $self
	ControlClick($self.title, 'Putuskan', 1038, 'left')
	Sleep(1000)
EndFunc   ;==>_eqsoDisconnect

Func _eqsoChangeRoom($self, $room)
	#forceref $self
	ControlSetText($self.title, '', 1001, '')
	ControlSend($self.title, '', 1001, $room & @CRLF)
	Sleep(1000)
EndFunc   ;==>changeRoom
